//
//  HSTabbarController.m
//  HolyShit
//
//  Created by Robin on 2016/9/27.
//  Copyright © 2016年 HolyShit. All rights reserved.
//

#import "HSTabbarController.h"
#import "HSListVC.h"
#import "HSMainAskVC.h"
#import "HSMainMeVC.h"
#import "HSLiveListVC.h"
#import "HSForumListVC.h"
#import "HSAwardListVC.h"
#import "HSKrMainMeVC.h"
#import "HSZhiHuMainMeVC.h"
#import "HSLotteryInfoVC.h"
#import "HSLotteryNumberVC.h"
#import "HSLotteryBallVC.h"

@interface HSTabbarController ()

@end

@implementation HSTabbarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupBaseVC];
}

- (void)setupBaseVC
{
    HSListVC *mainVC = [HSListVC new];
    [self setupTabForVC:mainVC title:@"首页" imageName:@"tab_sy_unselected" selectedImageName:@"tab_sy_selected"];
    UINavigationController *mainNav = [[UINavigationController alloc]initWithRootViewController:mainVC];
    
    HSLiveListVC *liveVC = [HSLiveListVC new];
    [self setupTabForVC:liveVC title:@"直播" imageName:@"tab_zb_unselected" selectedImageName:@"tab_zb_selected"];
    UINavigationController *liveNav = [[UINavigationController alloc]initWithRootViewController:liveVC];
    
    HSAwardListVC *caipiaoVC = [HSAwardListVC new];
    [self setupTabForVC:caipiaoVC title:@"开奖" imageName:@"tab_sy_unselected" selectedImageName:@"tab_sy_selected"];
    UINavigationController *caipiaoNav = [[UINavigationController alloc]initWithRootViewController:caipiaoVC];
    
    HSForumListVC *forumVC = [HSForumListVC new];
    [self setupTabForVC:forumVC title:@"社区" imageName:@"tab_zx_unselected" selectedImageName:@"tab_zx_selected"];
    UINavigationController *forumNav = [[UINavigationController alloc]initWithRootViewController:forumVC];
    
    HSMainAskVC *askVC = [HSMainAskVC new];
    [self setupTabForVC:askVC title:@"专栏" imageName:@"tabbar_fx_unselected" selectedImageName:@"tabbar_fx_selected"];
    UINavigationController *askNav = [[UINavigationController alloc]initWithRootViewController:askVC];
    
//    HSMainMeVC *meVC = [HSMainMeVC new];
//    HSKrMainMeVC *meVC = [HSKrMainMeVC new];
    HSZhiHuMainMeVC *meVC = [HSZhiHuMainMeVC new];
    [self setupTabForVC:meVC title:@"我的" imageName:@"tab_mine_unselected" selectedImageName:@"tab_mine_selected"];
    UINavigationController *meNav = [[UINavigationController alloc]initWithRootViewController:meVC];
    
    
    HSLotteryInfoVC *lotteryVC = [HSLotteryInfoVC new];
    [self setupTabForVC:lotteryVC title:@"首页" imageName:@"tab_sy_unselected" selectedImageName:@"tab_sy_selected"];
    UINavigationController *lotteryNav = [[UINavigationController alloc]initWithRootViewController:lotteryVC];
    
    HSLotteryNumberVC *lotteryNumberVC = [HSLotteryNumberVC new];
    [self setupTabForVC:lotteryNumberVC title:@"开奖号码" imageName:@"tab_sy_unselected" selectedImageName:@"tab_sy_selected"];
    UINavigationController *lotteryNumberNav = [[UINavigationController alloc]initWithRootViewController:lotteryNumberVC];
    
    HSLotteryBallVC *lotteryBallVC = [HSLotteryBallVC new];
    [self setupTabForVC:lotteryBallVC title:@"竞彩" imageName:@"tab_sy_unselected" selectedImageName:@"tab_sy_selected"];
    UINavigationController *lotteryBallNav = [[UINavigationController alloc]initWithRootViewController:lotteryBallVC];
    
    self.viewControllers = @[lotteryNav, lotteryBallNav,forumNav, askNav, meNav];
    self.tabBar.tintColor = HEXCOLOR(appNavColor);
    self.tabBar.backgroundColor = HEXCOLOR(HSColorTabbarBg);
    //    self.tabBar.barStyle = UIBarStyleBlack;
    self.tabBar.translucent = NO;
    //    self.navigationController.hidesBottomBarWhenPushed = YES;
}

- (void)setupTabForVC:(UIViewController *)vc
                title:(NSString *)title
            imageName:(NSString *)imageName
    selectedImageName:(NSString *)selectedImageName
{
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:imageName];
    vc.tabBarItem.selectedImage = [UIImage imageNamed:selectedImageName];
    vc.tabBarItem.titlePositionAdjustment = UIOffsetMake(0, -3);
}

@end
